package com.dingding.gmall.member.web;

import com.alibaba.fastjson.JSON;
import com.dingding.gmall.common.utils.R;
import com.dingding.gmall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * @author liugongding
 * @description:
 * @date 2022/4/4 3:44 PM
 */

@Controller
public class MemberWebController {

    @Autowired
    private OrderFeignService orderFeignService;


    @GetMapping("memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber, Model model){
        Map<String, Object> page = new HashMap<>();
        page.put("page", pageNumber);
        R r = orderFeignService.listWithItem(page);
        System.out.println(JSON.toJSONString(r));
        model.addAttribute("orders", r);
        return "memberOrder";
    }
}
